unit GarconDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TGarconData }

  TGarconData = class(TMainDataModule)
    GarconDatasource: TDatasource;
    GarconZQueryapelido: TStringField;
    GarconZQueryid_garcon: TLargeintField;
    GarconZQueryid_pessoa: TLargeintField;
    GarconZQuerynome_pessoa: TStringField;
    GarconZQuerystatus: TStringField;
    GarconZUpdate: TZUpdateSQL;
    GarconZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  GarconData: TGarconData;

implementation

uses ConnectionDM;

{ TGarconData }


procedure TGarconData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := GarconZQuery;
   GarconZQuery.Open;
end;
procedure TGarconData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(GarconZQuery, 'garcon');
end;

procedure TGarconData.CloseDataSet;
begin
  //GarconZQuery.Close();
end;

procedure TGarconData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(GarconZQuery, Tabela, Condicoes);
end;

initialization
  {$I garcondm.lrs}

end.

